﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Perceiveit.Xml.Converters
{
    #region public class ByteXConverter : XConverter<byte>

    public class ByteXConverter : XConverter<byte>
    {
        public override byte FromString(string value)
        {
            byte b;
            if (string.IsNullOrEmpty(value) || !byte.TryParse(value, out b))
                b = 0;

            return b;
        }

        public override string ToString(byte value)
        {
            return value.ToString();
        }
    }

    #endregion
}
